﻿/// <reference path="../jquery-2.0.2.min.js" />/// <reference path="../jquery.md5.js" />

$(document).ready(function () {
    $("#login").click(function () {
        var user = $("#account").val();
        var pwd = $("#password").val();
        if (isUndefinedNullOrEmpty(user) || isUndefinedNullOrEmpty(pwd)) {
            alert("请输入用户名或密码");
            return false;
        }
        else {
            poststr = "{\"type\":\"login\",\"username\":\"" + user + "\",\"password\":\"" + $.md5(pwd) + "\"}";
            mj_js_ajax("json", poststr, login);
        }

    })
   

})
function login(data) {
    var result = data;
    if (result.result == "ok") {
        var username = $("#account").val();
        $.cookie("manager_name", username);
        location.href = "Ask_Record.aspx?r=" + Math.random();
    }
    else {
            
        layer.alert('<div >账号或密码错误</div>', {
            icon: 2,
            title: '来自页面信息', //不显示标题
            skin: 'layer-ext-moon' }
    )
        }
    }